I make a website for dogs.
Minification, compilation, unit testing, linting, etc.
Node! Plugins! A Real Language! Street Cred!
This does not install grunt.
It's a shim to load up the local grunt.
{
"name": "grunt-demo",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.0"
}
}
module.exports = function(grunt) {
grunt.initConfig({});
};
A Function
function my_default_task () {
console.log('OH HAI!');
}
Most of what you need has already been written.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
Remember that initConfig
call?
grunt.initConfig({
uglify: {
options: {
banner: '/*! grunt-demo */\n'
},
build: {
src: 'some-file-you-wrote.js',
dest: 'some-file-you-wrote.min.js'
}
}
});
grunt.registerTask('default', ['jshint', 'uglify']);
http://ermahgerd.jmillerdesign.com/js/filters.js
ermahgerd: {
build: {
src: 'intro.txt',
dest: 'ermahgerd.txt'
}
}
var ermahgerd = require('./ermahgerd.js');
grunt.registerMultiTask('ermahgerd', 'Convert regular text to ERMAHGERD text.', function() {
grunt.file.write(this.data.dest, ermahgerd.translate(grunt.file.read(this.data.src).toUpperCase()));
});
http://gruntjs.com/plugins